package artiko.ai.attacco;
import net.sourceforge.jFuzzyLogic.FIS;


/**
 * Test parsing an FCL file
 * @author pcingola@users.sourceforge.net
 */
public class TestTipper 
{
    public static void main(String[] args) throws Exception
    {
        // Load from 'FCL' file
        String fileName = "artiko_resources/Attacco/tipper.fcl";
        FIS fis = FIS.load(fileName,true);
        // Error while loading?
        if( fis == null ) { 
            System.err.println("Can't load file: '" 
                                   + fileName + "'");
            return;
        }

        // Show 
        fis.chart();

        // Set inputs
        fis.setVariable("service", 7);
        fis.setVariable("food", 7);

        // Evaluate
        fis.evaluate();
        
        fis.evaluate();

        // Show output variable's chart 
        //fis.getVariable("tip").chartDefuzzifier(true);
        
        // 
        
        System.out.println("av" + fis.getVariable("tip").getMembership("average"));
        //System.out.println("ch" + fis.getVariable("tip").getMembership("cheap"));
        //System.out.println("gen" + fis.getVariable("tip").getMembership("generous"));


        // Print ruleSet
        System.out.println(fis);
    }
}
